package com.ba.base.view

import android.graphics.Color
import androidx.annotation.ColorInt

/**
 * @param type 当前主题类型
 * @param gray 灰阶显示
 * */
data class ThemeData(var type: EnumTheme, var gray: Boolean = false)

/**对应后台值 1-BLUE,2-RED,3-GRAY,4-GREEN,5-ORANGE*/
enum class EnumTheme(val color: Int) {
    BLUE(Color.parseColor("#0193DE")),
    GREEN(Color.parseColor("#03D47E")),
    ORANGE(Color.parseColor("#FF9F3E")),
    RED(Color.parseColor("#DF2417")),
    GRAY(Color.parseColor("#707070"));

    companion object {
        fun black(): Int {
            return Color.parseColor("#323230")
        }

        fun type(@ColorInt color: Int): EnumTheme {
            return values().find {
                it.color == color
            } ?: BLUE
        }

        fun transType(type: Int): EnumTheme {
            return when (type) {
                1 -> BLUE
                2 -> RED
                3 -> GRAY
                4 -> GREEN
                5 -> ORANGE
                else -> BLUE
            }
        }
    }
}